home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 17 / AMIGAplus Sonderheft 17 (1999)(ICP)(DE)[!].iso / Rexx / BrushFormat.pprx < prev    next >
Text File  |  1997-05-06  |  5KB  |  180 lines

  1. /* Personal Paint Amiga Rexx script - Copyright © 1997 Cloanto Italia srl */
  2.  
  3. /* $VER: BrushFormat.pprx 1.1 */
  4.  
  5. /** ENG
  6.  This script makes it possible to exactly set a new brush
  7.  format (size and number of colors).
  8.  
  9.  The new brush size can be specified in pixels or in
  10.  percentage of the original size. A value of 0 in one of
  11.  the two fields indicates that the original aspect ratio
  12.  should be preserved.
  13.  
  14.  If the brush size is reduced and the number of colors
  15.  is increased, and the "Color Average Resize" setting
  16.  is enabled, then the brush palette is extended with new
  17.  colors. This results in better antialiasing.
  18. */
  19.  
  20. /** DEU
  21.  Dieses Skript ermöglicht die präzise Einstellung eines Pinselformats (d. h.
  22.  Größe und Anzahl der Farben).
  23.  
  24.  Der neue Größenwert läßt sich wahlweise in Pixeln oder in Prozent der
  25.  ursprünglichen Größe angeben. Wird in eines der beiden Felder der Wert 0
  26.  eingetragen, so bedeutet dies, daß das ursprüngliche Höhen-/
  27.  Breitenverhältnis erhalten bleiben soll.
  28.  
  29.  Wenn die Pinselgröße verringert, die Anzahl der Farben gleichzeitig erhöht
  30.  und die Option "Farben mit Größe ändern" aktiviert wird, werden der
  31.  Pinselpalette neue Farben hinzugefügt, um eine bessere Kantenglättung zu
  32.  ermöglichen.
  33. */
  34.  
  35. /** ITA
  36.  Con questo script è possibile impostare con precisione il formato di
  37.  un nuovo pennello (dimensioni e numero di colori).
  38.  
  39.  Si possono specificare le dimensioni del nuovo pennello in pixel o come
  40.  percentuale delle dimensioni originali. Un valore di 0 in uno dei due
  41.  campi indica al programma di conservare l'aspetto originale (rapporto
  42.  larghezza/altezza).
  43.  
  44.  Se si riducono le dimensioni del pennello e si aumenta il numero di colori,
  45.  ed è attivo il parametro "Rimodellamento con media", la tavolozza del
  46.  pennello sarà ampliata con nuovi colori. Ciò consente un miglior effetto
  47.  di smorzamento seghettature (antialiasing).
  48. */
  49.  
  50. IF ARG(1, EXISTS) THEN
  51.     PARSE ARG PPPORT
  52. ELSE
  53.     PPPORT = 'PPAINT'
  54.  
  55. IF ~SHOW('P', PPPORT) THEN DO
  56.     IF EXISTS('PPaint:PPaint') THEN DO
  57.         ADDRESS COMMAND 'Run >NIL: PPaint:PPaint'
  58.         DO 30 WHILE ~SHOW('P',PPPORT)
  59.              ADDRESS COMMAND 'Wait >NIL: 1 SEC'
  60.         END
  61.     END
  62.     ELSE DO
  63.         SAY "Personal Paint could not be loaded."
  64.         EXIT 10
  65.     END
  66. END
  67.  
  68. IF ~SHOW('P', PPPORT) THEN DO
  69.     SAY 'Personal Paint Rexx port could not be opened'
  70.     EXIT 10
  71. END
  72.  
  73. ADDRESS VALUE PPPORT
  74. OPTIONS RESULTS
  75. OPTIONS FAILAT 10000
  76.  
  77. Get 'LANG'
  78. IF RESULT = 1 THEN DO        /* Deutsch */
  79.     txt_title_format  = "Pinselformat"
  80.     txt_gad_width     = "_Breite:"
  81.     txt_gad_height    = "_Höhe:"
  82.     txt_gad_unit      = "_Einheit:"
  83.     txt_gad_unit0     = "Pixel"
  84.     txt_gad_unit1     = "Prozent"
  85.     txt_gad_colors    = "_Farben:"
  86.     txt_err_oldclient = "Für dieses Skript_ist eine neuere Version_von Personal Paint erforderlich"
  87. END
  88. ELSE IF RESULT = 2 THEN DO    /* Italiano */
  89.     txt_title_format  = "Formato pennello"
  90.     txt_gad_width     = "_Larghezza:"
  91.     txt_gad_height    = "Al_tezza:"
  92.     txt_gad_unit      = "_Unità:"
  93.     txt_gad_unit0     = "Pixel"
  94.     txt_gad_unit1     = "Percentuale"
  95.     txt_gad_colors    = "C_olori:"
  96.     txt_err_oldclient = "Questa procedura richiede_una versione più recente_di Personal Paint"
  97. END
  98. ELSE DO            /* English */
  99.     txt_title_format  = "Brush Format"
  100.     txt_gad_width     = "_Width:"
  101.     txt_gad_height    = "_Height:"
  102.     txt_gad_unit      = "_Unit:"
  103.     txt_gad_unit0     = "Pixels"
  104.     txt_gad_unit1     = "Percentage"
  105.     txt_gad_colors    = "C_olors:"
  106.     txt_err_oldclient = "This script requires a newer_version of Personal Paint"
  107. END
  108.  
  109. Version 'REXX'
  110. IF RESULT < 7 THEN DO
  111.     RequestNotify 'PROMPT "'txt_err_oldclient'"'
  112.     EXIT 10
  113. END
  114.  
  115. LockGUI
  116. GetCurrentBrush
  117. currbsh = RESULT
  118. custombsh = (WORD(currbsh, 1) = 'BRUSH')
  119.  
  120. GetBrushAttributes 'WIDTH'
  121. bwidth = RESULT
  122. GetBrushAttributes 'HEIGHT'
  123. bheight = RESULT
  124.  
  125. req = ,
  126.    'INTSTR = ""'txt_gad_width'"", 0, 32000, 'bwidth' ' ||,
  127.    'INTSTR = ""'txt_gad_height'"", 0, 32000, 'bheight' ' ||,
  128.    'CYCLE = ""'txt_gad_unit'"", 2, 0, ""'txt_gad_unit0'"", ""'txt_gad_unit1'""'
  129.  
  130. IF custombsh THEN DO
  131.     GetBrushAttributes 'COLORS'
  132.     bcolors = RESULT
  133.     DO bdepth = 1 TO 8
  134.         IF 2 ** bdepth = bcolors THEN
  135.             BREAK
  136.     END
  137.     req = req ||,
  138.         ' SEPARATOR ' ||,
  139.         ' COLSLIDE = ""'txt_gad_colors'"", 1, 8, 'bdepth
  140. END
  141.  
  142. Request '"'txt_title_format'" "'req'"'
  143. IF RC = 0 THEN DO
  144.     new_bwidth  = RESULT.1
  145.     new_bheight = RESULT.2
  146.     unit        = RESULT.3
  147.     IF custombsh THEN
  148.         new_bcolors = 2 ** RESULT.4
  149.  
  150.     IF unit = 1 THEN DO
  151.         new_bwidth  = TRUNC(bwidth * new_bwidth / 100 + 0.5)
  152.         new_bheight = TRUNC(bheight * new_bheight / 100 + 0.5)
  153.     END
  154.  
  155.     IF new_bwidth ~= 0 | new_bheight ~= 0 THEN DO
  156.         IF new_bwidth = 0 THEN
  157.             new_bwidth = TRUNC(new_bheight * (bwidth / bheight) + 0.5)
  158.  
  159.         IF new_bwidth < 1 THEN
  160.             new_bwidth = 1
  161.  
  162.         IF new_bheight = 0 THEN
  163.             new_bheight = TRUNC(new_bwidth / (bwidth / bheight) + 0.5)
  164.  
  165.         IF new_bheight < 1 THEN
  166.             new_bheight = 1
  167.  
  168.         IF custombsh THEN DO
  169.             IF new_bwidth ~= bwidth | new_bheight ~= bheight | new_bcolors ~= bcolors THEN
  170.                 SetBrushAttributes 'WIDTH' new_bwidth 'HEIGHT' new_bheight 'COLORS' new_bcolors 'EXTENDPALETTE'
  171.         END
  172.         ELSE DO
  173.             IF new_bwidth ~= bwidth | new_bheight ~= bheight THEN
  174.                 SetCurrentBrush WORD(currbsh,1) 'WIDTH' new_bwidth 'HEIGHT' new_bheight
  175.         END
  176.     END
  177. END
  178.  
  179. UnlockGUI
  180.